package com.sixmac.controller;

import com.sixmac.common.base.BaseController;
import com.sixmac.core.plugins.dao.Blade;
import com.sixmac.model.Content;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * Created by admin on 2018/7/4.
 */
@Controller
public class ShareController extends BaseController {

    @RequestMapping("/shareVideo")
    public String shareVideo(Integer id, ModelMap mm) {
        Content content = Blade.create(Content.class).findById(id);
        mm.put("content", content);
        Integer categoryId = content.getCategoryId();
        List<Content> contentList = Blade.create(Content.class).findBy("categoryId =#{categoryId} order by thumbsnum desc", getCMap().put("categoryId", categoryId));
        mm.put("list", contentList);
        return "details.html";
    }


    @RequestMapping("/sharePulizhi")
    public String sharePulizhi(Integer id, ModelMap mm) {
        Content content = Blade.create(Content.class).findById(id);
        mm.put("content", content);
        return "details1.html";
    }

}


